import { Suspense } from 'react'

import { Switch, Route } from 'react-router-dom'
import login from './routes/login'
import admin from './routes/admin'

export const createLoginRoute = () => {
  return (
    <Suspense fallback={<div>loading...</div>}>
      <Route {...login} />
    </Suspense>
  )
}

export const createAdminRoute = () => {
  return (
    <Suspense fallback={<div>loading...</div>}>
      <Route path={admin.path} component={admin.component} />
    </Suspense>
  )
}

export const createRoute = () => {
  return (
    <>
      {createLoginRoute()}
      {createAdminRoute()}
    </>
  )
}
